<template>
  <a-config-provider :locale="zhCN">
    <NuxtLayout>
      <NuxtPage />
    </NuxtLayout>
  </a-config-provider>
</template>
<script setup>
import { onMounted } from "vue"
import zhCN from "ant-design-vue/es/locale/zh_CN"
onMounted(() => {
  flexible(window, document)
})
function flexible(window, document) {
  var docEl = document.documentElement
  function setPageFontsize() {
    document.documentElement.style.setProperty(
      "--vh",
      window.innerHeight / 100 + "px"
    )
    var clientWidth = window.innerWidth || docEl.clientWidth
    if (clientWidth <= 768) {
      var rem = 100 * (clientWidth / 750)
      rem && (docEl.style.fontSize = rem + "px")
    } else {
      docEl.style.fontSize = "83.3px"
    }
    if (window.resizeScreen) {
      window.resizeScreen()
    }
  }
  setPageFontsize()
  setTimeout(function () {
    setPageFontsize()
  }, 10)
  var resizeEvt = "orientationchange" in window ? "orientationchange" : "resize"
  window.addEventListener(resizeEvt, setPageFontsize)
  window.addEventListener("pageshow", function (e) {
    if (e.persisted) {
      setPageFontsize()
    }
  })
}
</script>
